package cz.muni.fi.pa165.dundd.entity;

import java.io.Serializable;
import java.util.List;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;

/**
 * The class contains information about a group of {@link Hero}es on a mission
 *
 * @author xceluch
 */
@Entity
public class Troop implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * ID of the {@code Troop} in the database
     */
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long id;

    /**
     * Name of the {@code Troop}
     */
    private String name;

    /**
     * Amount of golden money the {@code Troup} has earned
     */
    private int gold;

    /**
     * Mission assigned to the {@code Troup}
     */
    private String mission;

    /**
     * @return {@link Troop#name}
     */
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    /**
     *
     * @return {@link Troop#gold}
     */
    public int getGold() {
        return gold;
    }

    public void setGold(int gold) {
        this.gold = gold;
    }

    /**
     *
     * @return {@link Troop#mission}
     */
    public String getMission() {
        return mission;
    }

    public void setMission(String mission) {
        this.mission = mission;
    }


    /**
     *
     * @return {@link Troop#id}
     */
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        if (!(object instanceof Troop)) {
            return false;
        }
        Troop other = (Troop) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "Troop{" + "id=" + id + ", name=" + name + ", gold=" + gold + ", mission=" + mission + '}';
    }
    
    
}
